﻿IF OBJECT_ID('TraShenQingHuanZhe', 'U') IS NULL
    CREATE TABLE dbo.TraShenQingHuanZhe (
		TenantId       	   BIGINT NOT NULL,
        huanZheDaiMa       VARCHAR(128) NOT NULL,               -- 患者代码
        huanZheId          VARCHAR(128) NOT NULL,               -- 患者ID
        zhuYuanHao         NVARCHAR(128) NULL,                  -- 住院号
        menZhenHao         NVARCHAR(128) NULL,                  -- 门诊号
        shenFenZhengHao    NVARCHAR(128) NULL,                  -- 身份证号
        jiuZhenLeiXing     VARCHAR(50) NOT NULL,                -- 就诊类型(住院/门诊)
        xingMing           NVARCHAR(128) NULL,                  -- 姓名
        chuShaiABO         NVARCHAR(32) NULL,                   -- 初筛ABO
        chuShaiRhD         NVARCHAR(32) NULL,                   -- 初筛RhD
        xingBie            NVARCHAR(50) NULL,                   -- 性别
        nianLing           NVARCHAR(50) NULL,                   -- 年龄
        shenGao            DECIMAL(16, 4) NULL,                 -- 身高
        tiZhong            DECIMAL(16, 4) NULL,                 -- 体重
		tongYiShu 		  	NVARCHAR(50),						-- 同意书
        chuShengRiQi       NVARCHAR(50) NULL,                   -- 出生日期(年日月)
        bingQuId           NVARCHAR(50) NULL,                   -- 病区Id
        bingQu             NVARCHAR(50) NULL,                   -- 病区名称
        chuangHao          NVARCHAR(50) NULL,                   -- 床号
        shuXueShi          NVARCHAR(50) NULL,                   -- 输血史
        shuXueFanYingShi   NVARCHAR(50) NULL,                   -- 输血反应史
        yunChanShi         NVARCHAR(50) NULL,                   -- 孕产史
        yiZhiShi           NVARCHAR(50) NULL,                   -- 移植史
        danBingZhong       VARCHAR(50) NOT NULL,                -- 单病种
        iCDBianMa          VARCHAR(50) NOT NULL,                -- ICD编码
        linChuangZhenDuan  VARCHAR(1000) NOT NULL,              -- 临床诊断
        fuHeABO            VARCHAR(32) NOT NULL,                -- 复核ABO
        fuHeRhD            VARCHAR(32) NOT NULL,                -- 复核RhD
        huanZheBeiZhu      NVARCHAR(256) NULL,                  -- 患者备注
        jiuZhenId          NVARCHAR(128) NULL,                  -- 就诊Id
        jiuZhenCiShu       INT NULL,                  -- 就诊次数
        shuXueZhiZheng     INT NULL,                           -- 输血指征
        bingQingFenXi      NVARCHAR(250) NULL,                  -- 病情分析
        chuXueLiang        NVARCHAR(250) NULL,                  -- 出血量
        info1              NVARCHAR(250) NULL,                  -- 预留1
        info2              NVARCHAR(250) NULL,                  -- 预留2
        info3              NVARCHAR(250) NULL,                  -- 预留3
        info4              NVARCHAR(250) NULL,                  -- 预留4
        info5              NVARCHAR(250) NULL,                  -- 预留5
        Id                 VARCHAR(128) NOT NULL,               -- 单号,字符串,带前缀带流水，主键
        CONSTRAINT pk_TraShenQingHuanZhe PRIMARY KEY CLUSTERED (Id)
    );
GO

-- 添加表和列注释
IF OBJECT_ID('TraShenQingHuanZhe', 'U') IS NOT NULL
BEGIN
    EXEC sp_addcomment 'TraShenQingHuanZhe', '输血申请患者表', '', '';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'TenantId', '租户Id';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'huanZheDaiMa', '患者代码';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'huanZheId', '患者ID';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'zhuYuanHao', '住院号';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'menZhenHao', '门诊号';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'shenFenZhengHao', '身份证号';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'jiuZhenLeiXing', '就诊类型(住院/门诊)';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'xingMing', '姓名';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'chuShaiABO', '初筛ABO';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'chuShaiRhD', '初筛RhD';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'xingBie', '性别';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'nianLing', '年龄';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'shenGao', '身高';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'tiZhong', '体重';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'tongYiShu', '同意书';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'chuShengRiQi', '出生日期(年日月)';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'bingQuId', '病区Id';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'bingQu', '病区名称';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'chuangHao', '床号';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'shuXueShi', '输血史';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'shuXueFanYingShi', '输血反应史';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'yunChanShi', '孕产史';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'yiZhiShi', '移植史';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'danBingZhong', '单病种';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'iCDBianMa', 'ICD编码';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'linChuangZhenDuan', '临床诊断';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'fuHeABO', '复核ABO';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'fuHeRhD', '复核RhD';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'huanZheBeiZhu', '患者备注';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'jiuZhenId', '就诊Id';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'jiuZhenCiShu', '就诊次数';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'shuXueZhiZheng', '输血指征';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'bingQingFenXi', '病情分析';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'chuXueLiang', '出血量';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'info1', '预留1';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'info2', '预留2';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'info3', '预留3';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'info4', '预留4';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'info5', '预留5';
    EXEC sp_addcomment 'TraShenQingHuanZhe', '', 'Id', '单号,字符串,带前缀带流水，主键';
END
GO